import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import Layout from '@/layout'
// import FinancialRouter from './modules/financialStatistics'
// import transportRouter from './modules/tms'
// import BasicRouter from './modules/basicInfo'
// import systemRouter from './modules/systemManage'
// import nestedRouters3 from './modules/addedService'
// import manageServiceRouter from './modules/manageService'
// import wms from './modules/wms'
export const constantRoutes = [{
  path: '/redirect',
  component: Layout,
  hidden: true,
  children: [{
    path: '/redirect/:path*',
    component: () =>
                import('@/views/redirect/index')
  }]
},
{
  path: '/register',
  component: () =>
            import('@/views/register/index'),
  hidden: true
},
{
  path: '/printResult',
  component: () => import('@/views/systemManage/printResult/index'),
  hidden: true
},
{
  path: '/login',
  component: () =>
            import('@/views/login/index'),
  hidden: true
},
{
  path: '/authorization',
  component: () => import('@/views/systemManage/authorization/index'),
  hidden: true
},
{
  path: '/auth-redirect',
  component: () =>
            import('@/views/login/auth-redirect'),
  hidden: true
},
{
  path: '/404',
  component: () =>
            import('@/views/errorPage/404'),
  hidden: true
},
{
  path: '/401',
  component: () =>
            import('@/views/errorPage/401'),
  hidden: true
},
{
  path: '/',
  component: Layout,
  redirect: '/home',
  children: [{
    path: 'home',
    component: () =>
                import('@/views/home/index'),
    name: 'Dashboard',
    meta: {
      title: 'dashboard',
      icon: 'dashboard',
      affix: true
    }
  }]
},
{
  path: '/profile',
  component: Layout,
  redirect: '/profile/index',
  hidden: true,
  children: [{
    path: 'index',
    component: () =>
                import('@/views/profile/index'),
    name: 'Profile',
    meta: { title: 'profile', icon: 'user', noCache: true }
  }]
},
/* {
                        path: '*',
                        redirect: '/404',
                        hidden: true
                    }, */
{
  path: '/trackOfVehicle',
  component: () =>
            import('@/views/basicInfo/menu3/vehicleTrack'),
  hidden: true
},
{
  path: '/trackOfVehicleForMobile',
  component: () =>
            import('@/views/basicInfo/menu3/vehicleTrack/forMobile'),
  hidden: true
}
  // {
  //   path: 'shipper',
  //   component: () =>
  //             import('@/views/home/admin/shipper'),
  //   name: 'shipper',
  //   hidden: true,
  //   meta: {
  //     title: '入驻商首页',
  //     icon: 'dashboard',
  //     affix: true
  //   }
  // },
  // {
  //   path: 'driver',
  //   component: () =>
  //             import('@/views/home/admin/driver'),
  //   name: 'driver',
  //   hidden: true,
  //   meta: {
  //     title: '司机首页',
  //     icon: 'dashboard',
  //     affix: true
  //   }
  // },

  /* {
                      path: '*',
                      redirect: '/404',
                      hidden: true
                  }, */

  // BasicRouter,
  /* systemRouter,
          transportRouter,
            wms,
            manageServiceRouter,
            nestedRouters3,
            FinancialRouter,*/

]
const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  mode: 'history',
  base: 'wms_new',
  routes: constantRoutes
})
const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher
}

export default router
